import java.io.File;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

import TaggingSys.FileLabeler;


public class TagByKeyWord implements FileLabeler{

	HashMap<String,String> keyWordsMap;


	//CONSTRUCTR
	public TagByKeyWord() {
		keyWordsMap=new HashMap<String,String>();
		keyWordsMap.put("Music", "Music");
		keyWordsMap.put("music", "Music");
		keyWordsMap.put("mp3", "Music");
		keyWordsMap.put("song", "Music");
		keyWordsMap.put("Song", "Music");
		keyWordsMap.put("mp4", "Video");
		keyWordsMap.put("movie", "Video");
		keyWordsMap.put("Movie", "Video");
		keyWordsMap.put("Backup", "Backup");
		keyWordsMap.put("backup", "Backup");
		keyWordsMap.put("doc", "Document");
		keyWordsMap.put("docx", "Document");
		keyWordsMap.put("txt", "Document");
		keyWordsMap.put("pdf", "Document");
		keyWordsMap.put("MP3", "Music");
		keyWordsMap.put("bmp", "Picture");
		keyWordsMap.put("jpg", "Picture");
		keyWordsMap.put("gif", "Picture");
		keyWordsMap.put("UNIVERSITY", "University");
		keyWordsMap.put("university", "University");
		keyWordsMap.put("Bar Ilan", "University");
		keyWordsMap.put("BIU", "University");
		keyWordsMap.put("CS", "University");
		keyWordsMap.put("student", "University");
	}


	@Override
	public String[] label(File f) {
		
		String[] tags = new String[100];
		List<String> strings=new LinkedList<String>();
		String[] words=(f.getPath()).split("\\.");

		for(int i=0;i<words.length;i++){
			if(keyWordsMap.get(words[i])!=null)
				strings.add(keyWordsMap.get(words[i]));
		}
		int i = 0;
		while(i<(strings.size())){
			tags[i] = strings.get(i);
			i++;
		}
		return tags;

	}

}
